#Verkefni 15

#!/usr/bin/env python
# -*- coding: latin-1 -*-
# -*- coding: cp1252 -*-

f = open("PROBLEMB.DAT", "r")
linur = f.readlines()
	
def greining(x):
	x = float(x)
	x = x*1000000
	upp = 0
	nidur = 0
	while x < 1000000:
		x = invDown(x)
		nidur += 1
		if x > 1000000:
			x = invUp(down(x))
			upp += 1
			nidur -= 1
	return (upp, nidur)

def down(x):
	return int(x*0.8)
def invUp(x):
	return int(x/0.9)
def invDown(x):
	return int(x/0.8)

for x in range(len(linur)):
	print("Upp: %d, Niður: %d" % greining(linur[x].strip()))
	print()
